package cn.tedu.mintmall.service.Impl;

import cn.tedu.mintmall.dto.StockReduceCountDTO;
import cn.tedu.mintmall.mapper.StockMapper;
import cn.tedu.mintmall.service.IStockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class StockServiceImpl implements IStockService {

    @Autowired
    private StockMapper stockMapper;

    @Override
    public void reduceProductCount(StockReduceCountDTO stockReduceCountDTO) {
        stockMapper.updateReduceCountById(
                stockReduceCountDTO.getProductId(),
                stockReduceCountDTO.getCount()
        );
        log.info("库存减少完成");
    }
}
